home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
IPFlakeWay
/
Squelch Module
/
source
/
ProxyModule.h
< prev
Wrap
Text File
|
2000-06-23
|
4KB
|
153 lines
// =================================================================================
// ProxyModule.h ©1996 Sustainable Softworks. All rights reserved.
// =================================================================================
// Shared definitions between Proxy Module and Clients
#ifndef _H_ProxyModule
#define _H_ProxyModule
#pragma once
#include "MyTypes.h"
// ---------------------------------------
// • IOCTL Calls for Proxy Module
// ---------------------------------------
// Set monitor update events on or off
enum
{
I_MonitorOn = MIOC_CMD(MIOC_CFIG, 0),
I_MonitorOff = MIOC_CMD(MIOC_CFIG, 1),
I_SetPortName = MIOC_CMD(MIOC_CFIG, 2),
I_SetApparentAddress = MIOC_CMD(MIOC_CFIG, 3),
I_NatOn = MIOC_CMD(MIOC_CFIG, 4),
I_NatOff = MIOC_CMD(MIOC_CFIG, 5),
I_AgeNatTable = MIOC_CMD(MIOC_CFIG, 6),
I_SetActualNetwork = MIOC_CMD(MIOC_CFIG, 7),
I_SetOnDemandName = MIOC_CMD(MIOC_CFIG, 8),
I_OnDemandUp = MIOC_CMD(MIOC_CFIG, 9),
I_OnDemandDown = MIOC_CMD(MIOC_CFIG, 10),
I_OnDemandConnect = MIOC_CMD(MIOC_CFIG, 11),
I_GetFullMap = MIOC_CMD(MIOC_CFIG, 12),
I_GetStaticMap = MIOC_CMD(MIOC_CFIG, 13),
I_AddMapEntry = MIOC_CMD(MIOC_CFIG, 14),
I_DelMapEntry = MIOC_CMD(MIOC_CFIG, 15),
I_LocalNatOn = MIOC_CMD(MIOC_CFIG, 16),
I_LocalNatOff = MIOC_CMD(MIOC_CFIG, 17),
I_GetFilters = MIOC_CMD(MIOC_CFIG, 18),
I_AddFilterEntry = MIOC_CMD(MIOC_CFIG, 19),
I_DelFilterEntry = MIOC_CMD(MIOC_CFIG, 20),
I_GetPortNames = MIOC_CMD(MIOC_CFIG, 21),
I_SetMonitorName = MIOC_CMD(MIOC_CFIG, 22),
I_TRCableModem = MIOC_CMD(MIOC_CFIG, 23),
I_TRCableModemOff = MIOC_CMD(MIOC_CFIG, 24),
I_DNSForwardingOn = MIOC_CMD(MIOC_CFIG, 25),
I_DNSForwardingOff = MIOC_CMD(MIOC_CFIG, 26),
I_ClampMSS = MIOC_CMD(MIOC_CFIG, 27),
I_SetExposedHost = MIOC_CMD(MIOC_CFIG, 29)
};
// Ioctl response codes
const I_MonitorPause = 0;
const I_MonitorStart = 1;
const I_MonitorPending = 2;
const kProxyNoError = 0;
const kProxyOnDemand = 4;
const kProxyAddError = 5; // NAT table error adding entry
const kProxyDelError = 6; // Matching entry not found
const kProxyTableError = 7;
const size_t kTimerSize = 16;
const UInt32 kTimerDelay = 1000;
/*
* Define our timer message structure
*/
struct dl_timed_stat
{
SInt32 dl_primitive; // always DL_TIMED_STAT
SInt32 dl_sequence; // sequence number to identify this message
SInt32 dl_wCount; // our stats
SInt32 dl_rCount;
};
typedef struct dl_timed_stat dl_timed_stat_t;
#define DL_TIMED_STAT 1
// Define our Proxy message structures
// for Setting up NAT
struct proxy_name {
UInt32 portNameHash;
};
typedef struct proxy_name proxy_name_t;
struct proxy_network {
UInt32 portNameHash;
NetNumber_t net;
};
typedef struct proxy_network proxy_network_t;
struct proxy_age {
UInt32 portNameHash;
UInt32 age;
};
typedef struct proxy_age proxy_age_t;
struct proxy_mss { // TCP MSS clamp for PPPoE
UInt32 portNameHash;
UInt32 mssClamp;
};
typedef struct proxy_mss proxy_mss_t;
struct proxy_map_entry {
UInt32 portNameHash;
PortMapEntry_t mapEntry;
};
typedef struct proxy_map_entry proxy_map_entry_t;
// Identify what to monitor or translate
const UInt16 kProtocolTypeNone = 0x0000;
const UInt16 kProtocolTypeIP = 0x0800;
const UInt16 kProtocolTypeARP = 0x0806;
const UInt16 kProtocolTypeRARP = 0x8035;
//
// Structures for accessing NAT table
//
// define our port map message structure
#define kPortMapEntryDim 10
#define DL_PORT_MAP 2
struct dl_port_map {
SInt32 dl_primitive; // always DL_PORT_MAP
SInt16 dl_status; // 1="More" or 0="End of Table"
SInt16 dl_number; // number of entries reported
PortMapEntry_t array[kPortMapEntryDim];
};
typedef struct dl_port_map dl_port_map_t;
// selector values
#define kStaticMap 1
#define kFullMap 2
// define our filter table message structure
#define kFilterMessageDim 10
#define DL_FILTER_MESSAGE 3
struct dl_filter_message {
SInt32 dl_primitive; // always DL_FILTER_MESSAGE
SInt16 dl_status; // 1="More" or 0="End of Table"
SInt16 dl_number; // number of entries reported
FilterEntry_t array[kFilterMessageDim];
};
typedef struct dl_filter_message dl_filter_message_t;
#endif